package com.pr.makfilm.core.cmp.web;

import com.pr.makfilm.core.cmp.table.field.EnumDropDownField;
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;

/**
 * Created with IntelliJ IDEA.
 * User: Pawel
 * Date: 09.09.13
 * Time: 22:37
 * To change this template use File | Settings | File Templates.
 */
public class BootstrapEnumDropDownPanel<T extends Enum<T>> extends AbstractBootstrapComponent
{
   private EnumDropDownField<T> dropDownField;

   public BootstrapEnumDropDownPanel(String id, IModel<T> model, Class<T> enumClass, String cssClass)
   {
      this(id, model, enumClass);
      this.cssClass = cssClass;
   }

   public BootstrapEnumDropDownPanel(String id, IModel<T> model, Class<T> enumClass)
   {
      super(id);
      dropDownField = new EnumDropDownField<T>("dropdown", model, enumClass);
      container.add(dropDownField);
   }

   @Override
   public void setValidation(boolean required)
   {
      dropDownField.setRequired(required);
   }

   @Override
   public Component getField()
   {
      return dropDownField;
   }
}
